import 'package:mvvm_provider/model/response_model.dart';
import 'package:mvvm_provider/net/http_config.dart';
import 'package:mvvm_provider/net/ltt_https.dart';
import 'package:mvvm_provider/page/novel/data/repository/novel_api.dart';

class NovelRepository {
  static Future<ResponseModel> getNovelTabsData<T>() async {
    Map<String, dynamic> params = {
      'appkey': 'da44a5d9227fa9ef',
      'mobi_app': 'iphone_comic',
      'version': '5.11.0',
      'build': '1700',
      'channel': 'AppStore',
      'platform': 'ios',
      'device': 'phone',
      'buvid': 'Z2478A2AC97B74224D3FBE96297C8DF6FA4D',
      'machine': 'iPhone+13',
      'access_key':
          '4190755842052a685fd9f55724dbafa2CjDdaOgQ9baMW_QFtYv0tGUPEDeMGW54gRKLalyMVYymTpnrB5nLTWeHy_12rg_4GOgSVlVzUjdlS0lWRi1zSEJ0WEZRejdSSHQwakVmYUMxWmNadVItRzJNNFkyOTdpN0w5WmJ4ZXBZdE44ZU1uUTBTOEVCQjcwUVpBSU1RaWZlUy1aQnlZQmpnIIEC',
      'is_teenager': 'is_teenager',
      'no_recommend': '0',
      'network': 'wifi',
      'ts': '1697097473',
    };
    ResponseModel responseModel =
        await LttHttp().request<T>(NovelApi.listRankURL, params: params, method: HttpConfig.post);
    return responseModel;
  }

  static Future<ResponseModel> getNovelContentData<T>({int id = 7}) async {
    Map<String, dynamic> params = {
      'appkey': 'da44a5d9227fa9ef',
      'mobi_app': 'iphone_comic',
      'version': '5.11.0',
      'build': '1700',
      'channel': 'AppStore',
      'platform': 'ios',
      'device': 'phone',
      'buvid': 'Z2478A2AC97B74224D3FBE96297C8DF6FA4D',
      'machine': 'iPhone+13',
      'access_key':
          '4190755842052a685fd9f55724dbafa2CjDdaOgQ9baMW_QFtYv0tGUPEDeMGW54gRKLalyMVYymTpnrB5nLTWeHy_12rg_4GOgSVlVzUjdlS0lWRi1zSEJ0WEZRejdSSHQwakVmYUMxWmNadVItRzJNNFkyOTdpN0w5WmJ4ZXBZdE44ZU1uUTBTOEVCQjcwUVpBSU1RaWZlUy1aQnlZQmpnIIEC',
      'is_teenager': 'is_teenager',
      'no_recommend': '0',
      'network': 'wifi',
      'ts': '1697097473',
      'id': id,
      "offset": 0,
      "subId": 0
    };

    ResponseModel responseModel = await LttHttp()
        .request<T>(NovelApi.getRankInfoURL, params: params, method: HttpConfig.post);
    return responseModel;
  }
}
